package com.siao.example.socket;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.siao.net.socket.Connection;
import com.siao.net.socket.IConnectionHandler;
import com.siao.net.socket.IDataPack;

public class ClientHandler implements IConnectionHandler {

	private static final Logger logger = LoggerFactory.getLogger(ClientHandler.class);

	@Override
	public void onConnected(Connection connection) {
		logger.debug(connection + "onConnected.");

		DataPack data = new DataPack(2000, "HELLO".getBytes());
		connection.send(data);
	}

	@Override
	public void onConnectFailed(Connection connection) {
		logger.debug(connection + "onConnectFailed.");
	}

	@Override
	public void onSend(Connection connection, IDataPack data) {
		logger.debug(connection + "onSend.");
	}

	@Override
	public void onReceive(Connection connection, Object data) {
		logger.debug(connection + "onReceive.");
	}

	@Override
	public void onClose(Connection connection) {
		logger.debug(connection + "onClose.");
	}

	@Override
	public void onDisconnect(Connection connection) {
		logger.debug(connection + "onDisconnect.");
	}

}
